package com.ruku.RuKuservice;

import com.bean.WmsTBill;
import com.bean.WmsTBillDetails;
import com.bean.WmsTCustomer;
import com.ruku.RuKumapper.RuKuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class RuKuService {
    @Autowired
    RuKuMapper ruKuMapper;

    public List<WmsTCustomer> rukuselectCusmer(String custName){
        List<WmsTCustomer> wmsTCustomers = ruKuMapper.rukuselectCusmer(custName);
        return wmsTCustomers;
    }

    public void ruKuBanLiSetWmstBill(WmsTBill wmsTBill){
        ruKuMapper.ruKuBanLiSetWmstBill(wmsTBill);
        System.out.println("调用写入方法");
    }

    public List<WmsTBill> selectAllYbzpan(){
        List<WmsTBill> WmsTBills = ruKuMapper.selectAllYbzpan();
        return WmsTBills;
    }

    //根据billId获取wms_t_bill_details表的数据
    public List<WmsTBillDetails> selectAllBiDeTailsBybillId(String choosebillId){
        List<WmsTBillDetails> wmsTBillDetails = ruKuMapper.selectAllBiDeTailsBybillId(choosebillId);
        return wmsTBillDetails;
    }

    //验货装盘删除
    public void deleteYanHuoBydetailsId(String choosebillDetilId){
        ruKuMapper.deleteYanHuoBydetailsId(choosebillDetilId);
    }
    //验货结束，修改billState为1
    public void updateBillStateBybillId(String choosebillId333){
        ruKuMapper.updateBillStateBybillId(choosebillId333);
    }

    //----------------------------------------------------------------
    //入库结算
    public List<WmsTBill> selectBillByrkjSuan(){
        List<WmsTBill> wmsTBillsJieSuan = ruKuMapper.selectBillByrkjSuan();
        return wmsTBillsJieSuan;
    }

    public void updateBillByrkjsuan(WmsTBill wmsTBill){
        ruKuMapper.updateBillByrkjsuan(wmsTBill);
    }

    public List<Map<String,Object>> selectAllByMap(String billDate, String billEditTime, String huozhuName,String rukudanhao){
        List<Map<String,Object>> ALLwms = ruKuMapper.selectAllByMap(billDate,billEditTime,huozhuName,rukudanhao);
        System.out.println("service层的数据"+ALLwms);
        return ALLwms;
    }
        //货物入库，入库明细查询
    public List<Map<String,Object>> selectAllByRuKuDan(String billDate, String billEditTime, String huozhuName,String rukudanhao){
        List<Map<String,Object>> ALLwms2 = ruKuMapper.selectAllByRuKuDan(billDate,billEditTime,huozhuName,rukudanhao);
        return ALLwms2;
    }
        //入库单查询
    public List<WmsTBill> selectAllByRuKuDanChaXun(String billDate, String billEditTime, String huozhuName,String rukudanhao){
        List<WmsTBill> wmsTBills = ruKuMapper.selectAllByRuKuDanChaXun(billDate, billEditTime, huozhuName, rukudanhao);
        return wmsTBills;
    }
    //点击提交修改字段billState = '3'
    public void tuJiaoFromHWRku(String mingxibianhao){
        ruKuMapper.tuJiaoFromHWRku(mingxibianhao);
    }
    public WmsTBillDetails selectDetilsByHeId(String eveBillsRuKuId){
        WmsTBillDetails wmsTBillDetails = ruKuMapper.selectDetilsByHeId(eveBillsRuKuId);
        return wmsTBillDetails;
    }

    //入库单查询
    public WmsTBill selectBillsByHeId(String eveBillsRuKuDanId){
        WmsTBill wmsTBill = ruKuMapper.selectBillsByHeId(eveBillsRuKuDanId);
        return wmsTBill;
    }

    //根据入库单号删除入库单（修改删除字段为1）
    public boolean updateWmsBills1Byrukudanhao(String rukudanhao1){
        boolean b = ruKuMapper.updateWmsBills1Byrukudanhao(rukudanhao1);
        System.out.println(b);
        return b;
    }
    //修改入库单
    public boolean updateWmsBills2Byrukudanhao(String rukudanhao1,String lizifei1,String yewushijian1,String zuihoubianjishijian1,String danjuzhuangtai1){
        boolean c = ruKuMapper.updateWmsBills2Byrukudanhao(rukudanhao1, lizifei1, yewushijian1, zuihoubianjishijian1, danjuzhuangtai1);
        return c;
    }
}
